namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0019 : DbMigration
    {
        public override void Up()
        {
            //RenameTable(name: "dbo.AcmMasAccount", newName: "acm_mas_account");
            //RenameTable(name: "dbo.AcmMasAccountVersion", newName: "acm_mas_account_version");
            DropForeignKey("dbo.AcmMasAccount", "UpperAccountId", "dbo.AcmMasAccount");
            DropIndex("dbo.AcmMasAccount", new[] { "UpperAccountId" });
            //RenameColumn(table: "dbo.acm_mas_account", name: "AccountId", newName: "account_seq");
            //RenameColumn(table: "dbo.acm_mas_account", name: "AccountCode", newName: "account_code");
            //RenameColumn(table: "dbo.acm_mas_account", name: "UpperAccountId", newName: "upper_account_seq");
            //RenameColumn(table: "dbo.acm_mas_account", name: "AccountName", newName: "account_name");
            //RenameColumn(table: "dbo.acm_mas_account", name: "AccountDescr", newName: "account_descr");
            //RenameColumn(table: "dbo.acm_mas_account", name: "VersionId", newName: "version_seq");
            //RenameColumn(table: "dbo.acm_mas_account", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.acm_mas_account", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.acm_mas_account", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.acm_mas_account", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.acm_mas_account", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "VersionId", newName: "version_seq");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "VersionNo", newName: "version_no");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "VersionDescr", newName: "version_descr");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "UseFlag", newName: "use_flag");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.acm_mas_account_version", name: "UpdatedWhen", newName: "updated_when");
        }
        
        public override void Down()
        {
            RenameColumn(table: "dbo.acm_mas_account_version", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "use_flag", newName: "UseFlag");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "version_descr", newName: "VersionDescr");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "version_no", newName: "VersionNo");
            RenameColumn(table: "dbo.acm_mas_account_version", name: "version_seq", newName: "VersionId");
            RenameColumn(table: "dbo.acm_mas_account", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.acm_mas_account", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.acm_mas_account", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.acm_mas_account", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.acm_mas_account", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.acm_mas_account", name: "version_seq", newName: "VersionId");
            RenameColumn(table: "dbo.acm_mas_account", name: "account_descr", newName: "AccountDescr");
            RenameColumn(table: "dbo.acm_mas_account", name: "account_name", newName: "AccountName");
            RenameColumn(table: "dbo.acm_mas_account", name: "upper_account_seq", newName: "UpperAccountId");
            RenameColumn(table: "dbo.acm_mas_account", name: "account_code", newName: "AccountCode");
            RenameColumn(table: "dbo.acm_mas_account", name: "account_seq", newName: "AccountId");
            CreateIndex("dbo.AcmMasAccount", "UpperAccountId");
            AddForeignKey("dbo.AcmMasAccount", "UpperAccountId", "dbo.AcmMasAccount", "AccountId");
            RenameTable(name: "dbo.acm_mas_account_version", newName: "AcmMasAccountVersion");
            RenameTable(name: "dbo.acm_mas_account", newName: "AcmMasAccount");
        }
    }
}
